<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Panel</title>
<style type="text/css">
*{margin:0;padding:0;}	
body { padding: 60px }
.panel {position: relative; width: 100px; height:100px;border: 1px solid #0050D0;background: #96E555; cursor: pointer}
</style>
<script src="../../scripts/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function(){
		//给id为mover的元素添加动画.
		function animateIt() {
			$("#mover").slideToggle("slow", animateIt);
		}
		function animateIt2() {
			$("#mover").fadeToggle("slow", animateIt2);
		}
		animateIt();


		$("button").click(function(){
			if(!$('#mover').is(":animated")){		//判断元素是否正处于动画状态
				 //如果当前没有进行动画，则添加新动画 
				$('#mover').fadeToggle("slow", animateIt2);
			}else{
				$('#mover').stop();
			}
		});

    });
</script>
</head>
<body>
<button >click</button>
<div class="panel" id="mover">动画元素</div>
</body>
</html>